package com.zrkj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zrkj.entity.Zruser;
import com.zrkj.entity.vo.Result;
import com.zrkj.mapper.ZruserMapper;
import com.zrkj.service.IZruserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * @author : 司总
 * @className : IZruserServiceImpl
 * @package: com.zrkj.service.impl
 * @description : 用户表 服务接口实现
 * @date :  2023-11-23
 */
@Service("iZruserService")
public class IZruserServiceImpl extends ServiceImpl<ZruserMapper, Zruser> implements IZruserService{
/**
 * 添加
 *
 * @param zruser
 * @return
 */
@Override
@Transactional(rollbackFor = Exception.class)
public Result<String> add(Zruser zruser){
        return Result.success(this.save(zruser));
        }

/**
 * 更新
 *
 * @param zruser
 * @return
 */
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Boolean>  update(Zruser zruser){
        return Result.success(this.updateById(zruser));
        }

/**
 * 删除
 *
 * @param idList
 * @return
 */
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Boolean>  delete(List<String> idList){
        return Result.success(this.removeByIds(idList));
        }

/**
 * 查询详情
 *
 * @param id
 * @return
 */
@Override
public Result<Zruser> getById(String id){
        return Result.success(baseMapper.selectById(id));
        }

/**
 * 查询列表
 *
 * @param zruser
 * @return
 */
@Override
public Result<List<Zruser>>queryList(Zruser zruser){
        QueryWrapper<Zruser> queryWrapper=new QueryWrapper<Zruser>();
        return Result.success(this.list(queryWrapper));
        }

/**
 * 查询分页列表
 *
 * @param page
 * @param zruser
 * @return
 */
@Override
public Result<IPage<Zruser>>queryPageList(Page page, Zruser zruser){
        QueryWrapper<Zruser> queryWrapper=new QueryWrapper<Zruser>();
        IPage<Zruser> pageQuery=this.page(page,queryWrapper);
        return Result.success(pageQuery);
        }
        }
